package hlhj.fhp.checkpoint.module

import android.content.Context
import com.example.mymvp.mvp.BaseModule
import com.lzy.okgo.model.Response
import hlhj.fhp.checkpoint.http.Apis
import hlhj.fhp.checkpoint.http.CustomAction
import hlhj.fhp.checkpoint.http.LoadingAction
import hlhj.fhp.checkpoint.javaBean.MyBaseBean

/**
 * Created by Never Fear   on 2018\11\13 0013.
Never More....
 */
class ReportModule :BaseModule {
    var listener:ReportListener?=null
    fun addReport(c:Context,content:String){
        Apis.addReport(content)
                ?.let {
                    it.doOnSubscribe(LoadingAction(c))
                            .subscribe(object :CustomAction<Response<MyBaseBean>>(c){
                                override fun httpSuccess(t: Response<MyBaseBean>) {
                                    listener?.addReportResp(t.body())
                                }
                            })
                }
    }

    interface ReportListener{
        fun addReportResp(myBaseBean: MyBaseBean)
    }


}